package manager;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

import structures.clipboard.ClipboardBaseParameter;
import structures.clipboard.IClipboardObject;

public class ClipboardManager {

	public static String MAP_PREFIX_BASEPARAMETERS = "baseParameters";
//	private static String MAP_PREFIX_XML = "xmls";

	public static void addToClipboard(ClipboardBaseParameter clipboardObject){
		SessionManager.setClipBoardObject(MAP_PREFIX_BASEPARAMETERS, clipboardObject);
	}
	
//	TODO:
//	public static void addToClipboard(ClipboardXml clipboardObject){
//		SessionManager.setClipBoardObject(MAP_PREFIX_XML, clipboardObject);
//	}
//	
//	public static IClipboardObject loadFromClipboard(String clipboardID){
//		return SessionManager.getClipboardObject(clipboardID);
//	}
	
	public static Collection<IClipboardObject> loadBaseParametersFromClipboard(boolean clearAfterLoad){
		HashMap<String, IClipboardObject> map =
				SessionManager.getClipBoardObjectMap(MAP_PREFIX_BASEPARAMETERS);
		if(clearAfterLoad)
			clearBaseParametersFromClipboard();
		
		if(map == null)
			return new ArrayList<IClipboardObject>();
		
		return map.values();
	}
	
	public static void clearBaseParametersFromClipboard(){
		SessionManager.setClipBoardObjectMap(MAP_PREFIX_BASEPARAMETERS, null);
	}
}
